<template>
  <div class="contant">
    <div
      style="
        width: 100%;
        height: 60px;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: lightblue;
        margin-bottom: 10px;
      "
    >
      <h2>vue组件案例</h2>
    </div>
    <div style="width: 100%; display: flex; flex-wrap: wrap">
      <div class="c-item" v-for="(item, index) in routerList" :key="index">
        <div @click="go(item.path)">{{ item.meta.name }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import routerList from "../router/router";
export default {
  components: {},
  data() {
    return {
      routerList: routerList,
    };
  },
  methods: {
    // 路由跳转并在新的页面打开
    go(path) {
      let routeUrl = this.$router.resolve({
        path: path,
      });
      window.open(routeUrl.href, "_blank");
    },
  },
};
</script>

<style scoped>
.c-item {
  width: 19%;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: skyblue;
  margin: 0.5%;
  cursor: pointer;
}
</style>
